package com.lbh.structures.components;

import com.alibaba.fastjson.annotation.JSONField;
import com.jogamp.opengl.GL2;
import com.lbh.structures.common.GameObject;

/***
 * project:JRuntime
 * package:com.lbh.structures.components
 *
 * @author user:lenovo QQ:1601078366
 * @date 2021/10/22 0:48
 * @version V1.0
 */
public class Component {

    @JSONField(serialize = false, deserialize = false)
    public GameObject gameObject;

    public void start(){
    }

    public void update(){
    }

    public void fixedUpdate(){
    }

    public void render(GL2 gl){
    }

    protected <T extends Component> T addComponent(Class<T> type){
        return gameObject.addComponent(type);
    }

    protected <T extends Component> T getComponent(Class<T> type){
        return gameObject.getComponent(type);
    }

    protected <T extends Component> T removeComponent(Class<T> type){
        return gameObject.removeComponent(type);
    }

}
